#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), spriteBatch(0)
{

    setPalette(Qt::blue);

    pixmap = new QPixmap(":/graphics/sprite1.png");
}

MainWindow::~MainWindow()
{
    delete spriteBatch;
}


void MainWindow::paintEvent(QPaintEvent *event)
{
    if(!spriteBatch) spriteBatch = new QPainterSpriteBatch(width(), height(), this, this);

    tester.run(1/60.0f);
    spriteBatch->begin();
    tester.draw( spriteBatch, (int)pixmap );
    spriteBatch->end();

    update();
}
